if (wgGet::isValue('api')) {
	$code = wgGet::getValue('api');
	$group = IchatGroupsModel::getOneCodeData($code);
	$id = $group->getId();
	if (IchatGroupsModel::validateUserGroup($id)) {
		$group = IchatGroupsModel::getOneUserData($id, moduleUsers::getId());
		$id = $group->getId();
	}
	else $id = 0;
}
if (!(bool) $id) {
	wgError::add('You have to create your iChat group first', 1);
	wgPaths::redirectToReferer();
	exit();
}
